﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pay.Data.Mapping {
    public partial class TopicMap : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<Topic> {
        public TopicMap() {
            ToTable("mc_Topic", "dbo");

            HasKey(t => t.Id);
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.Title)
                .HasColumnName("Title")
                .IsRequired();
            Property(t => t.MerchantId)
                .HasColumnName("MerchantId")
                .IsRequired();
            Property(t => t.ShowImages)
                .HasColumnName("ShowImages")
                .IsRequired();
            Property(t => t.ShowType)
                .HasColumnName("ShowType")
                .IsRequired();
            Property(t => t.Banner)
                .HasColumnName("Banner")
                .IsRequired();
            Property(t => t.CreateTime)
                .HasColumnName("CreateTime")
                .IsRequired();
            Property(t => t.Remark)
                .HasColumnName("Remark")
                .IsOptional();

            // Relationships
            HasRequired(t => t.Merchant)
                .WithMany()
                .HasForeignKey(d => d.MerchantId)
                .WillCascadeOnDelete(false);
        }
    }
}
